package com.funmi.lizip.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.funmi.lizip.common.base.R;
import com.funmi.lizip.entity.PatrolTrack;
import com.funmi.lizip.entity.dto.patrolTrack.PatrolTrackQueryRequest;
import com.funmi.lizip.entity.dto.photo.PhotoSQueryRequest;
import com.funmi.lizip.entity.vo.*;
import com.funmi.lizip.service.PatrolTrackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "考勤模块")
@RequestMapping("/Statistics")
public class StatisticsController {
    @Autowired
    private PatrolTrackService patrolTrackService;

    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "分页展示考勤")
    @GetMapping("/rangerId")
    public R tong(PatrolTrackQueryRequest request){
        Page<AttendanceVo> detailed = patrolTrackService.getDetailed(request);
        // getStatistics(request);
        return R.success().data(detailed);
    }


    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "根据巡护人员id 获取考勤列表")
    @GetMapping("/{id}")
    public R kaoQing(@PathVariable int id){
        List<PatrolTrackByIdVo> result = patrolTrackService.getStatistics(id);
        return R.success().data(result);
    }

    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "考勤统计分析")
    @GetMapping("")
    public R tongji(){
        StatisticsAllVo statisticsAllVo = patrolTrackService.getStatisticsAll();
        return R.success().data(statisticsAllVo);
    }

}
